<?php
 $tracking=array(
   array('StationCode'=>1,
      "RIYADH"=>'1234',
       'Date'=>"2018-12-24T22:19:09.787",
       'ActivityCode'=>'123',
 "Data Registered"=>'123',
       "ArabicActivity"=>"تم تسجيل بيانات الشحنة",
       "WaybillNo"=>'68064684',
       "ClientID"=>'1234',
       "ErrorMessage"=>'123',
       "Comments"=>'123',
       "DeliveryStatusID"=>'12345',
       "EventCode"=>'0'
   )
 );
 $d=array(
     array('StationCode'=>1,
         "RIYADH"=>'123',
         'Date'=>"2018-12-25T12:19:09.789",
         'ActivityCode'=>'123',
         "Data Registered"=>'123',
         "ArabicActivity"=>"تم تسجيل بيانات الشحنة",

     )
 );
//$e=array_merge( $tracking,$d);
//$res=arraySort($e,'Date',$sort='desc');
//
//echo "<pre>";
//print_r($res);
//echo "<pre>";
/*
 * Array
(
    [0] => Array
        (
            [StationCode] => 1
            [RIYADH] => 1234
            [Date] => 2018-12-24T22:19:09.787
            [ActivityCode] => 123
            [Data Registered] => 123
            [ArabicActivity] => 鬲賲 鬲爻噩賷賱 亘賷丕賳丕鬲 丕賱卮丨賳丞
            [WaybillNo] => 68064684
            [ClientID] => 1234
            [ErrorMessage] => 123
            [Comments] => 123
            [DeliveryStatusID] => 12345
            [EventCode] => 0
        )

    [1] => Array
        (
            [StationCode] => 1
            [RIYADH] => 123
            [Date] => 2018-12-24T12:19:09.789
            [ActivityCode] => 123
            [Data Registered] => 123
            [ArabicActivity] => 鬲賲 鬲爻噩賷賱 亘賷丕賳丕鬲 丕賱卮丨賳丞
            [WaybillNo] => 68064684
            [ClientID] => 1234
            [ErrorMessage] => 123
            [Comments] => 123
            [DeliveryStatusID] => 12345
            [EventCode] => 0
        )

)
 *
 */
//二维数组降序排序
function arraySort($array,$keys,$sort='asc') {
    $newArr = $valArr = array();
    foreach ($array as $key=>$value) {
        $valArr[$key] = $value[$keys];
    }
    ($sort == 'asc') ?  asort($valArr) : arsort($valArr);
    reset($valArr);
    foreach($valArr as $key=>$value) {
        $newArr[$key] = $array[$key];
    }
    return $newArr;
}
$src="2018-12-24T12:19:09.789";
//时区转化
function toTimeZone($src, $from_tz = 'America/Denver', $to_tz = 'Asia/Shanghai', $fm = 'Y-m-d H:i:s') {
    $datetime = new DateTime($src, new DateTimeZone($from_tz));
    $datetime->setTimezone(new DateTimeZone($to_tz));
    return $datetime->format($fm);
}
$res=toTimeZone($src);
var_dump($res);
?>